const url = require("url");
let urlObj = {
    'host': 'www.gogole.com',
    'port': '80',
    'protocol': 'http',
    'search': '?q=node.js',
    'query': 'q=node.js',
    'path': '/'
};
let urlAddress = url.format(urlObj);
console.log(urlAddress);

/**
 * http://www.gogole.com?q=node.js
 */